<template>
  <view class="content">
    <web-view v-if="ip" :src="`../../static/html/upload.html?i=${ip}&p=${port}&v1=${v1}&v2=${v2}`"></web-view>
  </view>
</template>

<script setup>
import { ref, defineProps } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import useComputerStore from "@/store/modules/computer.js";

const computerStore = useComputerStore();

let ip = ref("");
let port = ref("");
let v1 = ref("");
let v2 = ref("");
onLoad((options) => {
  ip.value = options.ip;
  port.value = options.port;
  for (let i = 0; i < computerStore.computerList.length; i++) {
    let item = computerStore.computerList[i];
    if (item.ip == ip.value && item.port == port.value) {
      v1.value = btoa(item.key.slice(0, 30));
      v2.value = btoa(item.key.slice(30));
    }
  }
});
</script>

<style lang="scss" scoped></style>
